<?php

namespace app\admin\model;

use tools\MenuTools;
use think\Model;

class PermissionModel extends Model
{
    protected $table = 'permissions';

    protected $hidden = [];

    protected $autoWriteTimestamp = true;

    /**
     * 修改角色权限
     * @param int $roleId 角色Id
     * @param array $menus 为解压菜单列表
     * @throws \think\Exception
     * @throws \think\exception\PDOException
     */
    public static function updatePermission($roleId, $menus)
    {
        MenuTools::setMenu($roleId, MenuTools::deMenu($menus));
    }
}
